99 wetlands
Retrieving wetland boundaries from the National Wetlands Inventory (NWI)
The National Wetlands Inventory (NWI) is a comprehensive geospatial inventory of U.S. wetlands. It is a publicly available resource that provides detailed information on the abundance, characteristics, and distribution of wetlands in the United States. The NWI dataset is maintained by the U.S. Fish and Wildlife Service (USFWS) and is used by a wide range of stakeholders, including federal, state, and local agencies, researchers, and conservation organizations.
The notebook demonstrates how to retrieve wetland boundaries from the NWI using the leafmap Python package. The NWI dataset is available as a web service, which allows users to access the data programmatically. The leafmap package provides a simple interface for querying the NWI web service and visualizing the wetland boundaries on an interactive map.
Uncomment the following line to install leafmap if needed.
# %pip install -U leafmap
import leafmap
m = leafmap.Map(center=[47.223940, -99.885386], zoom=14)
m.add_basemap("HYBRID")
m
Google Maps API key is required to use Google Maps. You can generate one from https://bit.ly/3sw0THG and use geemap.set_api_key(), defaulting to Esri basemaps.
Using point geometry¶
point_geometry = {"x": -99.907986, "y": 47.216359}
gdf = leafmap.get_nwi(point_geometry)
m = leafmap.Map(center=[47.223940, -99.885386], zoom=14)
m.add_basemap("HYBRID")
m.add_nwi(gdf, add_legend=True)
m
Google Maps API key is required to use Google Maps. You can generate one from https://bit.ly/3sw0THG and use geemap.set_api_key(), defaulting to Esri basemaps.
Using bounding box¶
bbox_geometry = {"xmin": -99.9023, "ymin": 47.211, "xmax": -99.8556, "ymax": 47.2325}
gdf = leafmap.get_nwi(bbox_geometry)
m = leafmap.Map()
m.add_basemap("HYBRID")
m.add_nwi(gdf, layer_name="Wetlands", zoom_to_layer=True)
m
Google Maps API key is required to use Google Maps. You can generate one from https://bit.ly/3sw0THG and use geemap.set_api_key(), defaulting to Esri basemaps.
Using GeoDataFrame¶
bbox = [-99.8653, 47.3952, -99.7498, 47.4441]
bbox_geometry = leafmap.bbox_to_gdf(bbox)
bbox_geometry
| geometry | |
|---|---|
| 0 | POLYGON ((-99.8653 47.3952, -99.8653 47.4441, ... |
gdf = leafmap.get_nwi(bbox_geometry)
m = leafmap.Map()
m.add_basemap("HYBRID")
m.add_nwi(gdf, layer_name="Wetlands", zoom_to_layer=True)
m
Google Maps API key is required to use Google Maps. You can generate one from https://bit.ly/3sw0THG and use geemap.set_api_key(), defaulting to Esri basemaps.
Using HUC8 watershed boundary¶
huc8 = "11120104"
gdf = leafmap.get_nwi_by_huc8(huc8, quiet=False)
Downloading... From: https://documentst.ecosphere.fws.gov/wetlands/downloads/watershed/HU8_11120104_Watershed.zip To: /tmp/HU8_11120104_Watershed.zip
0%| | 0.00/4.36M [00:00<?, ?B/s]
60%|██████ | 2.62M/4.36M [00:00<00:00, 8.67MB/s]
100%|██████████| 4.36M/4.36M [00:00<00:00, 14.0MB/s]
Extracting files...
m = leafmap.Map()
m.add_basemap("HYBRID")
m.add_nwi(gdf, layer_name="Wetlands", zoom_to_layer=True)
m
Google Maps API key is required to use Google Maps. You can generate one from https://bit.ly/3sw0THG and use geemap.set_api_key(), defaulting to Esri basemaps.